#ifndef SPRITE__H
#define SPRITE__H

#include "drawable.h"
#include "frame.h"
#include "parseXML.h"

class Sprite : public Drawable {
public:
  explicit Sprite(float x, float y, float xs, float ys, Frame* f) : 
    Drawable(x, y, xs, ys), frame(f),
    xmlParser(ParseXML::getInstance()),
    screenWidth(xmlParser->getXmlInt("screen_width")),
    screenHeight(xmlParser->getXmlInt("screen_height"))
   { }

  explicit Sprite(const Sprite& s) :
    Drawable(s.getX(), s.getY(), s.getXSpeed(), s.getYSpeed()), 
             frame(s.frame),
    xmlParser(ParseXML::getInstance()),
    screenWidth(xmlParser->getXmlInt("screen_width")),
    screenHeight(xmlParser->getXmlInt("screen_height"))
 { }
  // destructor doesn't delete anything because nothing was
  // created (new) in this class:
  virtual ~Sprite() {
	  xmlParser = NULL;
	  } 
  const Frame *getFrame() const { return frame; }
  void  deleteFrame() { delete frame; }

  virtual void draw() const;
  virtual void update(Uint32 ticks);
  Sprite& operator=(const Sprite&);

private:
  const Frame * const frame;
  ParseXML* xmlParser;
  int screenWidth;
  int screenHeight;

};
#endif
